<?php

namespace App\Http\Controllers\Client\Member;

use App\Http\Controllers\RootController as Controller;
use App\Models\Org;
use Encore\Admin\Facades\Admin;
use Illuminate\Http\Request;

class OrgListController extends Controller
{
    public function handle(Request $request)
    {
        $param['type'] = (int)$request->get('type', 0);


        $query = Org::orderBy('id', 'desc');

        $userOrg = Org::find($this->user()->org_id);

        $query->where('type', $param['type']);

        $query->where('path', 'like', $this->user()->org->path.'%');

        $rows = $query->get();

        return $this->success($rows);
    }
}
